package com.zhuyp.spring.boot;

/**
 * 计数器
 * 
 * @author zhuyanpeng
 */
public class Counter {

	public Integer getSum() {
		return sum;
	}

	public void setSum(Integer sum) {
		this.sum = sum;
	}

	private volatile Integer sum = 0;

	public synchronized void add(Integer numer) {
		sum += numer;
	}

	public synchronized void minus(Integer numer) {
		sum -= numer;
	}

}
